package com.xuecheng.auth.config;

import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
public class MyRunner implements CommandLineRunner {

    @Override
    public void run(String... args) throws Exception {
        new Thread(() -> {
            while(true) {
                // 逻辑代码
                try {
                    int hour = LocalDateTime.now().getHour();
                    if(hour>18){

                    }
                    Thread.sleep(1000*60*60*24); // 模拟工作
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }).start();
    }
}
